﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage< ChoViet.CMS.ViewModels.CategoryEditViewModel>" %>
<%@ Import Namespace="ChoViet.Lib.Helpers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Thêm mới Chuyên mục
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%if (ViewData["MessageInfo"] == null)
  { %>
<% using (Html.BeginForm("CreateCms", "Category", FormMethod.Post, new { id = "adminForm", enctype = "multipart/form-data" }))
   {%>
    <%= Html.ValidationSummary(true)%>
    
    <fieldset>
        <legend>Thêm mới</legend>
        <font color="red">(*)</font> là trường bắt buộc phải nhập.
        <table class="admintable">
            <tbody>
                <tr>
                    <td class="key">
                        Chuyên mục cha
                    </td>
                    <td>
                        <%=Html.DropDownListFor(model => model.Category.ParentID, new SelectList(Model.ParrentCatrgories, "ID", "Name").ToList(), "-- Chọn chuyên mục cha --")%>
                    </td>
                </tr>
                <tr>
                    <td class="key">
                        Tên chuyên mục  (<font color="red">*</font>)
                    </td>
                    <td>
                        <%= Html.TextBoxFor(model => model.Category.Name, new { @class = "required", title="Nhập tên chuyên mục" })%>
                    </td>
                </tr>
                <tr>
                    <td class="key">
                        Icon đại diện
                    </td>
                    <td>
                        <input type="file" id="catimage" name="catimage" />
                    </td>
                </tr>                 
                <tr>
                    <td class="key">
                        Mô tả
                    </td>
                    <td>
                        <%= Html.TextBoxFor(m => m.Category.Description)%>
                    </td>
                </tr>
                <%--<tr>
                    <td class="key">
                        Độ ưu tiên
                    </td>
                    <td>
                        <%= Html.TextBoxFor(m => m.Category.Priority, new { @class = "digits" })%>
                    </td>
                </tr>--%>
                <tr>
                    <td colspan="2" align="center">
                        <input type="submit" value="Thêm mới" />
                    </td>
                </tr>
            </tbody>
        </table>
    </fieldset>
    <% }
  } %>
    
    <script type="text/javascript">
        $(document).ready(function() {
            $("#adminForm").validate();
        });
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Toolbar" runat="server">
    <%= Html.Toolbar("Quay về", "/Category/IndexCms/", "back")%>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Header" runat="server">
    Thêm mới chuyên mục
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Message" runat="server">
<%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%> 
</asp:Content>
